<template>
  <div class="cookbook">
    <!-- <div class="cookbook" v-loading.fullscreen.lock="fullscreenLoading"> -->
    <div class="top_box">
      <div class="logo">菜篮子</div>
      <div class="car_box">每日菜谱推荐</div>
      <div class="right_top">
        <!-- 首页 -->
        <router-link to="/home">
          <div class="home">
            <span class="iconfont icon-shouye-shouye"></span>首页
          </div>
        </router-link>
        <!-- 购物车 -->
        <router-link to="/shoppingcar">
          <div class="car">
            <span class="iconfont icon-gouwuche1"></span>
            购物车
          </div>
        </router-link>
      </div>
    </div>

    <div class="container">
      <div class="menu_box">
        <div class="title">精选推荐菜谱</div>
        <ul class="jxlist">
          <li class="item" v-for="(item, index) in menuList" :key="index">
            <div>
              <router-link
                class="cover"
                :to="'/delicacies?id=' + item.item_id"
                style="position: relative"
              >
                <div>
                  <!-- <img
                    src="https://cp1.douguo.com/upload/caiku/9/a/e/400x266_9a7a8bd7c5a2069c7586da513bbe2e3e.jpeg"
                    alt="自制芒果沙冰｜巨巨巨好喝"
                  /> -->
                  <img :src="item.img" />
                </div>
              </router-link>
              <div class="relative">
                <a class="cookname text-lips">## {{ item.t }}</a>
                <!-- <a class="cookname text-lips">##</a> -->
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <footerpage></footerpage>
  </div>
</template>

<script>
import footerpage from "../components/FooterPage.vue";
import { getCookBook } from "../api/menu.js";
export default {
  data() {
    return {
      menuList: null,
      // fullscreenLoading: false,
    };
  },

  methods: {
    // // 加载页面
    // openFullScreen1() {
    //   this.fullscreenLoading = true;
    //   setTimeout(() => {
    //     this.fullscreenLoading = false;
    //   }, 1000);
    // },
    // 调用接口
    getCookBookFun() {
      getCookBook().then((data) => {
        console.log(data.result.rfs);
        this.menuList = data.result.rfs;
        // console.log(this.menuList);
        // data.result.forEach((item) => {
        //   // this.menuList = item;
        //   console.log(item);
        // });
        // this.menuList = data.result.rfs
      });
    },
  },
  created() {
    this.getCookBookFun();
  },
  mounted() {
    this.getCookBookFun();
  },
  components: {
    footerpage,
  },
};
</script>

<style lang="scss">
.cookbook {
  width: 100%;
  height: 100%;
  .top_box {
    width: 100%;
    background-color: #ad0002;
    display: flex;
    height: 70px;
    align-items: center;
    justify-content: space-around;
    .logo {
      font-family: "font";
      font-weight: 700;
      font-size: 65px;
      color: #fff;
      transform: rotateZ(355deg);
      position: relative;
      img {
        position: absolute;
        top: 44px;
        right: 1px;
        width: 20px;
        height: 20px;
        border-radius: 7px;
      }
    }
    .car_box {
      margin: 0 170px;
      font-size: 35px;
      color: #fff;
      font-family: "font";
      font-weight: 700;
    }
    .right_top {
      display: flex;
      .home {
        color: #fff;
        font-size: 17px;
        padding-right: 70px;

        .icon-shouye-shouye {
          padding-right: 5px;
          font-size: 20px;
        }
      }
      .car {
        color: #fff;
        font-size: 17px;
        padding-right: 70px;

        .icon-gouwuche1 {
          padding-right: 5px;
          font-size: 20px;
          position: relative;
        }
        .car_num {
          position: absolute;
          top: -4px;
          right: -1px;
          width: 16px;
          border-radius: 50%;
          height: 16px;
          line-height: 17px;
          text-align: center;
          background: rgb(44, 199, 26);
          color: #fff;
          font-size: 12px;
          transform: scale(0.8);
        }
      }
    }
  }
  .menu_box {
    padding-top: 50px;
    width: 1000px;
    margin: 0 auto;
    height: 100%;
    // position: absolute;
    // right: 0;
    // left: 0;
    padding-bottom: 100px;

    .title {
      font-size: 25px;
      color: #333;
      line-height: 20px;
      font-weight: bold;
      margin-bottom: 25px;
    }
    .jxlist {
      .item {
        float: left;
        width: calc(33.3333% - 40px);
        height: 255px;
        overflow: hidden;
        margin: 0 40px 40px 0;
      }
      .cover {
        width: 220px;
        height: 180px;
        overflow: hidden;
        border-radius: 8px;
        display: inline-block;
        // background: #f9f9f9;
        img {
          width: 100%;
          height: 100%;
          vertical-align: bottom;
        }
      }
      .relative {
        position: relative;
        width: 220px;
        .cookname {
          display: block;
          font-size: 15px;
          color: #333;
          line-height: 15px;
          padding: 19px 7px;
        }
      }
    }
  }
}
</style>